﻿using System;
using System.Web.UI;
using System.Web.UI.WebControls;


namespace Sample
{
	public partial class CommonControls : System.Web.UI.Page
	{
		protected override void RaisePostBackEvent(IPostBackEventHandler sourceControl, string eventArgument)
		{
			base.RaisePostBackEvent(sourceControl, eventArgument);
		}

		protected void sampleCheckBoxList_SelectedIndexChanged(object sender, EventArgs e)
		{
			if (sampleCheckBoxList.SelectedItem != null)
				sampleCheckBoxLabel.Text = sampleCheckBoxList.SelectedItem.Text;
		}

		protected void sampleRadioButtonList_SelectedIndexChanged(object sender, EventArgs e)
		{
			ListItem item = sampleListBox.Items.FindByValue(sampleRadioButtonList.SelectedValue);
			if (item != null)
				sampleListBox.SelectedIndex = sampleListBox.Items.IndexOf(item);
		}

		protected void sampleListBox_SelectedIndexChanged(object sender, EventArgs e)
		{
			ListItem item = sampleRadioButtonList.Items.FindByValue(sampleListBox.SelectedValue);
			if (item != null)
				sampleRadioButtonList.SelectedIndex = sampleRadioButtonList.Items.IndexOf(item);
		}

		protected void sampleCalendar_SelectionChanged(object sender, EventArgs e)
		{
			sampleLabel.Text = sampleCalendar.SelectedDate.ToLongDateString();
		}
	}
}
